// pages/companydetail/companydetail.js
const app = getApp()
Page({
  data: {
    topattr: ['', '', '', '', '', ''],
  },

  onLoad: function (options) {
    console.log(options)
  
    this.setData({
      eoid: options.eoid,
    })
    // this.getdetail()
  },
  onShow(){
     this.getdetail()
  },
  getdetail(){
    let that=this;
    wx.request({   //传后台
      url: app.globalData.url + '/jxb/eorder/foundOrderListInfo',
      method: 'POST',
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      data: {
        eoid: this.data.eoid,
        token: wx.getStorageSync('token'),
        uid: wx.getStorageSync('uid'),
      },
      success: function (res) {
        console.log(res.data.data)
        let imgsattr = res.data.data[0].eorderpics;
        let topattr = that.data.topattr;
        if (imgsattr.length == 1) {
          topattr = ['A', 'A', 'A', 'A', 'A', 'A',];
        } else if (imgsattr.length == 2) {
          topattr = ['A', 'A', 'A', 'B', 'B', 'B',];
        } else if (imgsattr.length == 3) {
          topattr = ['A', 'A', 'B', 'B', 'C', 'C',];
        } else if (imgsattr.length == 6) {
          topattr = ['A', 'B', 'C', 'D', 'E', 'F',];
        }
        that.setData({
          infor: res.data.data,
          topattr: topattr,
          eorderpics: res.data.data[0].eorderpics
        })
      },

    })
  },
  companyedit(e){  //修改
    let item = e.currentTarget.dataset.item;
    let picstatus = e.currentTarget.dataset.picstatus;
    if (picstatus==2){
      wx.navigateTo({
        url:'/pages/upimg/upimg?type=companyedit'+'&companyitem='+JSON.stringify(item)
      })
    }
  },
  copyText(e) {  //复制
    wx.setClipboardData({
      data: e.currentTarget.dataset.text,
      success: function (res) {
        wx.getClipboardData({
          success: function (res) {
            wx.showToast({
              title: '复制成功'
            })
          }
        })
      }
    })
  },
  seeview(e) {//预览图片
    let pidiurl = e.currentTarget.dataset.pidiurl
    wx.previewImage({
      urls: [pidiurl],
    })
  },

})